<template>
  <el-container class="index-con">
    <el-aside :class="showclass" style="box-shadow: 0 0 10px 2px #919191;z-index: 10">
      <left></left>
    </el-aside>
    <el-container class="main-con">
      <el-header class="index-header" style="box-shadow: 0 0 10px 2px #919191;z-index: 9">
        <headtop></headtop>
      </el-header>
      <el-main>
        <transition name="el-zoom-in-center">
          <div v-if="show" class="transition-box">
            <router-view/>
          </div>
        </transition>
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
// 导入组件
import headtop from './headtop'
import left from './left'

export default {
  name: 'index',
  data() {
    return {
      show: true,
      showclass: 'asideshow',
    }
  },
  // 注册组件
  components: {
    headtop,
    left
  },
  methods: {},
  created() {
    // 监听
    this.$root.Bus.$on('toggle', value => {
      if (value) {
        this.showclass = 'asideshow'
      } else {
        this.showclass = 'aside'
      }
    })
    // 监听菜单发送的通知,执行缩放动画
    this.$root.Bus.$on('animation', value => {
      this.show = false
      this.$nextTick(() => {
        this.show = true
      })
    })
  }
}
</script>
<style>
* {
  user-select: none;
}

.index-con {
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}

.aside {
  transition: width .3s;
  width: 64px !important;
  height: 100%;
  background-color: #ffffff;
  margin: 0;
}

.asideshow {
  transition: width .3s;
  width: 230px !important;
  height: 100%;
  background-color: #ffffff;
  margin: 0;
}

.index-header {
  padding: 0px;
  border-left: 0px solid #333;
}

::-webkit-scrollbar {
  width: 0 !important;
}

::-webkit-scrollbar {
  width: 0 !important;
  height: 0;
}
</style>
